package com.sea.app.common.excrption;

/**
 * Created by 31417 on 2017/4/23.
 */
public class SystemException extends RuntimeException{
    private String code;
    private Object data;

    protected SystemException(String message) {
        super(message);
    }

    protected SystemException(String message, Throwable cause) {
        super(message, cause);
    }

    protected SystemException(Throwable cause) {
        super(cause);
    }

    protected SystemException() {
        super();
    }

    protected SystemException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public SystemException setCode(String code) {
        this.code = code;
        return this;
    }

    public SystemException setData(Object data){
        this.data = data;
        return this;
    }
    public SystemException setMessage(String msg){
        this.setMessage(msg);
        return this;
    }
    public static SystemException on(Throwable e){
        return new SystemException(e);
    }
    public static SystemException on(String code, String msg){
        return new SystemException(msg).setCode(code);
    }

}
